ознайомитися з спадкуванням та інтерфейсами у мові Java

Інформація про навчальний заклад

ВУЗ:
Національний університет Львівська політехніка
Інститут:
ІКТА
Факультет:
Інститут комп’ютерних технологій, автоматики та метрології
Кафедра:
Електронні обчислювальні машини

Інформація про роботу

Рік:
2013
Тип роботи:
Лабораторна робота
Предмет:
Кросплатформенні засоби програмування
Група:
КІ
Варіант:
20

Частина тексту файла

МІНІСТЕРСТВО ОСВІТИ, НАУКИ, МОЛОДІ ТА СПОРТУ УКРАЇНИ НАЦІОНАЛЬНИЙ УНІВЕРСИТЕТ “ЛЬВІВСЬКА ПОЛІТЕХНІКА” Кафедра ЕОМ  Лабораторна робота № 3 з дисципліни "Кросплатформенні засоби програмування" Львів – 2013 Тема: класи та пакети. Мета: ознайомитися з процесом розробки класів та пакетів мовою Java. Текст програми: package KI44.Ryndych.lab3; import java.io.FileNotFoundException; import java.util.Scanner; /** * testing the Tile class * @author suna_no_oshiro * */ public class driver { public static Scanner in = new Scanner(System.in); public static int str; public static int numberOfBurners; public static int timer; public static int temperature; public static int burnerNumber; public static Tile tile; /** * @param args * @throws FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException{ System.out.print("enter number of the burners : "); numberOfBurners = in.nextInt(); tile = new Tile(numberOfBurners); tile.getOvenStatus(); System.out.print("set the oven temperature : "); temperature = in.nextInt(); tile.setTheOvenTemperature(temperature); System.out.print("set the oven timer : "); timer = in.nextInt(); tile.setTheOvenTimer(timer); System.out.print("set number of the burner you wonted turn on (from 1 to "+numberOfBurners +") : "); burnerNumber = in.nextInt(); tile.turnOnTheBurner(burnerNumber-1); tile.turnOnTheOven(); tile.getTheOvenTemperature(); System.out.print("set the burner's power (low - 1|| medium - 2 || high - 3) : "); str = in.nextInt(); if(str == 3){ tile.switchTheBurnerPower(burnerNumber-1, "high"); } else if (str == 2){ tile.switchTheBurnerPower(burnerNumber-1,"medium"); } else if (str == 1){ tile.switchTheBurnerPower(burnerNumber-1,"low"); } tile.turnOffTheBurner(burnerNumber-1); tile.turnOffTheOven(); tile.closeFileout(); } } package KI44.Ryndych.lab3; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; /** * * @author suna_no_oshiro * */ public class Tile { /** * massive of the burners */ public Burner burners[]; /** * oven */ public Oven oven = new Oven(); /** * */ private PrintWriter fileOut; /** * default constructor initialize the burners[], file & fileOut * @throws FileNotFoundException */ public Tile() throws FileNotFoundException { burners = new Burner[4]; for(int i=0; i<4; i++) burners[i]= new Burner(); try{ File file = new File("out.lab3.txt"); fileOut = new PrintWriter(file); } catch(FileNotFoundException e){ System.out.print(e.getMessage()); } } /** * constructor initialize the burners[numberOfBurners], file & fileOut * @param numberOfBurners * @throws FileNotFoundException */ public Tile(int numberOfBurners) throws FileNotFoundException { burners = new Burner[numberOfBurners]; for(int i=0; i<numberOfBurners; i++) burners[i]= new Burner(); try{ File file = new File("out.lab3.txt"); fileOut = new PrintWriter(file); } catch(FileNotFoundException e){ System.out.print(e.getMessage()); } } /** * set the oven temperature & print massage about it in the file * @param temperature oven temperature */ public void setTheOvenTemperature(int temperature){ oven.setTemperature(temperature); fileOut.println("the oven temperature was set, it is "+temperature+" degrees"); } /** *get the oven temperature & print massage about it in the file */ public void getTheOvenTemperature(){ fileOut.println("the oven temperature is "+oven.getTemperature()+ " degrees"); } /** * set the oven timer & print massage about it in the file * @param timer oven timer */ public void setTheOvenTimer(int timer){ oven.setTimer(timer); fileOut.println("the oven timer was set, it is " + timer +" minutes"); } /** * get the oven timer & print massage about it in the file */ public void ge...
Антиботан аватар за замовчуванням

02.01.2014 17:01

Коментарі

Ви не можете залишити коментар. Для цього, будь ласка, увійдіть або зареєструйтесь.

Завантаження файлу

Якщо Ви маєте на своєму комп'ютері файли, пов'язані з навчанням( розрахункові, лабораторні, практичні, контрольні роботи та інше...), і Вам не шкода ними поділитись - то скористайтесь формою для завантаження файлу, попередньо заархівувавши все в архів .rar або .zip розміром до 100мб, і до нього невдовзі отримають доступ студенти всієї України! Ви отримаєте грошову винагороду в кінці місяця, якщо станете одним з трьох переможців!
Стань активним учасником руху antibotan!
Поділись актуальною інформацією,
і отримай привілеї у користуванні архівом! Детальніше

Оголошення від адміністратора

Антиботан аватар за замовчуванням

пропонує роботу

Admin

26.02.2019 12:38

Привіт усім учасникам нашого порталу! Хороші новини - з‘явилась можливість кожному заробити на своїх знаннях та вміннях. Тепер Ви можете продавати свої роботи на сайті заробляючи кошти, рейтинг і довіру користувачів. Потрібно завантажити роботу, вказати ціну і додати один інформативний скріншот з деякими частинами виконаних завдань. Навіть одна якісна і всім необхідна робота може продатися сотні разів. «Головою заробляти» продуктивніше ніж руками! :-)

Новини